import redis
import env_config

def redisConn(redisinfo):
    pool = env_config.get_redis_value(redisinfo.get('redis_name'))
    if pool is None:
        redisConf = env_config.REDIS_LIST.get(redisinfo.get('redis_name'))
        pool = redis.ConnectionPool(host=redisConf.get('ip'), port=redisConf.get('port'),password = redisConf.get('password'),db=redisinfo.get('redis_index'))
    return redis.Redis(connection_pool = pool)


if __name__=='__main__':
    env_config._init()
    r1 = redisConn()
    #r1 = redis.Redis(host='10.194.80.12',port=6379,db=15)
    print(r1)
    print(r1.get('account:11111111111'))